//********************************************************************************************************
// Product Name: MapWindow.dll Alpha
// Description:  The core libraries for the MapWindow 6.0 project.
//
//********************************************************************************************************
// The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 
// you may not use this file except in compliance with the License. You may obtain a copy of the License at 
// http://www.mozilla.org/MPL/ 
//
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 
// ANY KIND, either expressed or implied. See the License for the specificlanguage governing rights and 
// limitations under the License. 
//
// The Original Code is from MapWindow.dll version 6.0
//
// The Initial Developer of this Original Code is Ted Dunsford. Created 2/21/2008 9:30:47 AM
// 
// Contributor(s): (Open source contributors should list themselves and their modifications here). 
//
//********************************************************************************************************

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.ComponentModel;
using MapWindow;
using MapWindow.Main;
using MapWindow.Data;
using MapWindow.Drawing;
using MapWindow.Geometries;

using MapWindow.DirectX;
using MapWindow.DirectX.PluginInterfaces;
namespace MapWindow.DirectX.Components
{


    /// <summary>
    /// IDataManager
    /// </summary>
    public interface ILayerManagerDX
    {
        #region Events

        /// <summary>
        /// Occurs after the directory providers have been loaded into the project.
        /// </summary>
        event EventHandler DirectoryProvidersLoaded;

        #endregion


        #region Methods

        #region OpenLayer

        /// <summary>
        /// This launches an open file dialog and attempts to load the specified file.
        /// </summary>
        ILayerDX OpenLayer();

        /// <summary>
        /// This launches an open file dialog and attempts to load the specified file.
        /// </summary>
        /// <param name="container">The layer will be created in the specified collection</param>
        /// <returns>A Layer</returns>
        ILayerDX OpenLayer(ICollection<ILayer> container);

        /// <summary>
        /// Opens an entire folder at once.
        /// </summary>
        /// <param name="container"></param>
        /// <returns></returns>
        ILayerDX OpenFolder(ICollection<ILayer> container);


        /// <summary>
        /// Opens an entire folder at once.
        /// </summary>
        /// <param name="directory"></param>
        /// <param name="container"></param>
        /// <returns></returns>
        ILayerDX OpenFolder(string directory, ICollection<ILayer> container);

        


        /// <summary>
        /// This launches an open file dialog and attempts to load the specified file.
        /// </summary>
        /// <param name="progressHandler">Specifies the progressHandler to receive progress messages.  This value overrides the property on this DataManager.</param>
        /// <returns>A Layer</returns>
        ILayerDX OpenLayer(IProgressHandler progressHandler);

        /// <summary>
        /// Opens a new layer and automatically adds it to the specified container.
        /// </summary>
        /// <param name="filename">A String filename to attempt to open.</param>
        /// <param name="container">The container (usually a LayerCollection) to add to</param>
        /// <returns>The layer after it has been created and added to the container</returns>
        ILayerDX OpenLayer(string filename, ICollection<ILayer> container);
      
        /// <summary>
        /// This launches an open file dialog and attempts to load the specified file.
        /// </summary>
        /// <param name="filename">A String filename to attempt to open.</param>
        /// <param name="progressHandler">Specifies the progressHandler to receive progress messages.  This value overrides the property on this DataManager.</param>
        /// <returns>A Layer</returns>
        ILayerDX OpenLayer(string filename, IProgressHandler progressHandler);
       

        /// <summary>
        /// Attempts to call the open filename method for any IDataProvider plugin
        /// that matches the extension on the string.
        /// </summary>
        /// <param name="filename">A String filename to attempt to open.</param>
        ILayerDX OpenLayer(string filename);

        /// <summary>
        /// Attempts to call the open filename method for any IDataProvider plugin
        /// that matches the extension on the string.
        /// </summary>
        /// <param name="filename">A String filename to attempt to open.</param>
        /// <param name="inRam">A boolean value that if true will attempt to force a load of the data into memory.  This value overrides the property on this DataManager.</param>
        /// <param name="container">any valid ICollection of ILayer that this should be added to</param>
        /// <param name="progressHandler">Specifies the progressHandler to receive progress messages.  This value overrides the property on this DataManager.</param>
        /// <param name="filterIndex">An integer index value that indicates which dialog filter member was chosen in the open file dialog</param>
        ILayerDX OpenLayer(string filename, bool inRam, ICollection<ILayer> container, IProgressHandler progressHandler, int filterIndex);

     
      

       
      
       


        #endregion


    
        /// <summary>
        /// Checks a dialog filter and returns a list of just the extensions.
        /// </summary>
        /// <param name="DialogFilter">The Dialog Filter to read extensions from</param>
        /// <returns>A list of extensions</returns>
        List<string> GetSupportedExtensions(string DialogFilter);

        /// <summary>
        /// Given a string filename for the "*.dll" file, this will attempt to load any classes that implement the
        /// IDataProvder interface.
        /// </summary>
        /// <param name="filename">The string path of the assembly to load from.</param>
        /// <returns>A list that contains only the providers that were just loaded.  This may be a list of count 0, but shouldn't return null.</returns>
        List<ILayerProviderDX> LoadProvidersFromAssembly(string filename);

        /// <summary>
        /// This should be called once all the permitted directories have been set in the code.
        /// This will not affect the PreferredProviders or the general list of Providers.
        /// These automatically have the lowest priority and will only be used if nothing
        /// else works.  Use the PreferredProviders to force preferential loading of 
        /// a plugin DataProvider.
        /// </summary>
        /// <returns>A list of just the newly added DataProviders from this method.</returns>
        List<ILayerProviderDX> LoadProvidersFromDirectories();

        #endregion

        #region Properties


        /// <summary>
        /// Gets or sets a temporary list of active project layers.  This is designed to house 
        /// the layers from a map frame when the property grids are shown for layers in that
        /// map frame.  This list on the DefaultLayerManager is what is used to create the
        /// list that populates dropdowns that can take a Layer as a parameter.
        /// </summary>
        IList<ILayerDX> ActiveProjectLayers
        {
            get;
            set;
        }
     
        /// <summary>
        /// Gets or sets the list of IDataProviders that should be used in the project.
        /// </summary>
        List<ILayerProviderDX> LayerProviders
        {
            get;
            set;
        }

        

        /// <summary>
        /// Gets or sets the path (either as a full path or as a path relative to
        /// the MapWindow.dll) to search for plugins that implement the IDataProvider interface.
        /// </summary>
        List<string> LayerProviderDirectories
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the dialog read filter to use for opening data files.
        /// </summary>
        string DialogReadFilter
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the dialog write filter to use for saving data files.
        /// </summary>
        string DialogWriteFilter
        {
            get;
            set;
        }

        /// <summary>
        /// Sets the default condition for how this data manager should try to load layers.
        /// This will be overridden if the inRam property is specified as a parameter.
        /// </summary>
        bool LoadInRam
        {
            get;
            set;
        }


     
        /// <summary>
        /// Gets or sets a progress handler for any open operations that are intiated by this 
        /// DataManager.
        /// </summary>
        IProgressHandler ProgressHandler
        {
            get;
            set;
        }


        #endregion

       


        
        

    }
}
